import React from "react";
import { useNavigate } from "react-router-dom";
import { ListType } from "../../Type/index";
import { ProductCard } from "react-vant";

interface itemType {
  item: ListType;
}

const Index: React.FC<itemType> = ({ item }) => {
  const navigate = useNavigate();
  return (
    <div
      className="list-item"
      onClick={() => navigate(`/detail/${item.body.product_id}`)}
    >
      <ProductCard
        price={item.body.price}
        desc={item.body.desc}
        title={item.body.name}
        thumb={item.body.image}
      />
    </div>
  );
};

export default Index;
